home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
SETUP.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-15
|
28KB
|
569 lines
;
interrupts segment at 0h ;interrupt table segment
org 9h*4
keyboard_int dw 2 dup (?) ;interrupt 9 vector
interrupts ends
;
rom_bios_data segment at 40h ;ROM BIOS data area segment
org 60h
;
cursor_mode dw ? ;starting and ending cursor scan lines
rom_bios_data ends
;
rom segment at 0F000h ;ROM segment
org 0FFFEh
;
machine_id db ? ;ID byte identifies machine as PCjr or other
rom ends
;
code segment para public 'code' ;code segment
assume cs:code
org 100h
;
begin: jmp initialize ;goto initialization routine
;
db '(C) Copyright 1986, Ziff-Davis Publishing Company ', 1Ah
;
column_count dw ? ;width of window in columns
cursor_type dw ? ;cursor scan line definition
setup_status db 0 ;indicates if printer window is already active
display_mode dw ? ;current crt display mode
page_no dw ? ;current displayed page
attribute1 db 4Fh ;window attribute bytes
attribute2 db 70h
;
display_table db 2Dh,29h ;display re-enable values for modes 2 and 3
video dw 0B800h,0B900h,0BA00h,0BB00h ;starting addresses of video
;memory for CGA pages 0 - 3
;
mono_video dw 0B000h ;video segment address for
;monochrome adapter
;
old_kb_int label dword
old_keyboard_int dw 2 dup (?) ;storage for old keyboard
;interrupt vector
;
;----------------------------------------------------------------------------
;Text of the Printer Setup Menu window.
;After initialization, text and attribute bytes are combined and stored
;in the WINDOW_TEXT area, and this area is used to store the contents of
;the screen that underlie the window when the window is called up.
;----------------------------------------------------------------------------
;
window_buffer label word
buffer_text db 201,26 dup (205),187
db 186,' PRINTER SETUP MENU ',186
db 186,' EPSON RX/FX PRINTERS ',186
db 199,26 dup (196),182
db 186,' F1 Compressed Mode ',186
db 186,' F2 Expanded Mode ',186
db 186,' F3 Emphasized Mode ',186
db 186,' F4 Double-Strike Mode ',186
db 186,' F5 Elite Mode ',186
db 186,' F6 Miniature Mode ',186
db 186,' F7 Skip Perforation ',186
db 186,' F8 Indent Left Margin ',186
db 186,' F9 Reset Top-of-Form ',186
db 186,' F10 Reset Print Modes ',186
db 186,' ESC Exit ',186
db 199,26 dup (196),182
db 186,' Unshifted: Toggle ON ',186
db 186,' Shifted: Toggle OFF ',186
db 200,26 dup (205),188
db 532 dup (?)
;
;Storage area for the combination of text and attribute bytes that
;form the window image.
;
window_bytes label byte
window_text dw 532 dup (?)
;
;Control code strings for all of the printer setup options.
;
code_table: db 15,255,14 dup (0) ;compressed mode on
db 27,87,1,255,12 dup (0) ;expanded mode on
db 27,69,255,13 dup (0) ;emphasized mode on
db 27,71,255,13 dup (0) ;double-strike mode on
db 27,77,255,13 dup (0) ;elite mode on
db 15,27,83,0,27,65,6,255,8 dup (0) ;miniature mode on
db 27,78,12,255,12 dup (0) ;perfskip on
db 27,108,10,255,12 dup (0) ;indent left margin
db 27,67,66,255,12 dup (0) ;reset top-of-form
db 18,27,87,0,27,70,27,72,27,80,27,84,27,50,255,0 ;reset
;print modes
;
db 18,255,14 dup (0) ;compress off
db 27,87,0,255,12 dup (0) ;expand off
db 27,70,255,13 dup (0) ;emphasize off
db 27,72,255,13 dup (0) ;double-strike off
db 27,80,255,13 dup (0) ;elite off
db 18,27,84,27,50,255,10 dup (0) ;miniature off
db 27,79,255,13 dup (0) ;perfskip off
db 27,108,0,255,12 dup (0) ;indent off
;
;---------------------------------------------------------------------------
;Execution comes here, to the main body of the program, when an interrupt 9
;is generated from the keyboard. Registers are saved, then the keypress is
;checked and compared to the key combination that activates the menu window.
;---------------------------------------------------------------------------
;
main proc near
sti ;enable software interrupts
push ax ;save all registers
push bx
push cx
push dx
push si
push di
push ds
push es
push ax ;save ax for call to old routine
in al,0A0h ;re-enable NMI on PCjr
pop ax ;restore ax
pushf ;simulate interrupt call to old keyboard routine
call old_kb_int ;call old routine
mov ah,2 ;check status of the shift keys
int 16h
and al,5 ;Ctrl and Rt-Shift depressed?
cmp al,5
je do_program ;yes, then skip exit routine
;
;Exit routine is the common point of exit for all routines in the program.
;
exit: pop es
pop ds
pop di
pop si
pop dx
pop cx
pop bx
pop ax
iret
;
;Execution comes here when the proper key combination, Ctrl/Rt-Shift, is
;pressed. First task is to check whether or not the window is already open.
;
do_program: push cs ;set es and ds to the code segment
pop ds
push cs
pop es
cmp setup_status,0 ;is the window already open?
jne exit ;yes, then ignore request
;
;----------------------------------------------------------------------------
;Check current video mode. If it's mode 2, 3, or 7, then set the window
;status flag, store the mode number and page number, save the cursor type,
;and hide the cursor. If any other display mode is active instead, ignore
;the request and exit.
;----------------------------------------------------------------------------
;
mov ah,15 ;get page and mode numbers
int 10h ;al=mode, bh=page
cmp al,2 ;is crt now in an acceptable mode?
je prog0 ;yes, then continue
cmp al,3
je prog0
cmp al,7
je prog0
jmp exit ;no, then ignore request
prog0: mov setup_status,1 ;set status flag to indicate
;that window is active